//
//  UIView+Common.swift
//  invest_account_books
//
//  Created by volientDuan on 2017/11/17.
//  Copyright © 2017年 volient. All rights reserved.
//

import UIKit
extension UIView {
    var x : CGFloat {
        set {
            self.frame = CGRect.init(origin: CGPoint.init(x: newValue, y: self.frame.origin.y), size: self.frame.size)
        }
        get {
            return self.frame.origin.x
        }
    }
    
    var y : CGFloat {
        set {
            self.frame = CGRect.init(origin: CGPoint.init(x: self.frame.origin.x, y: newValue), size: self.frame.size)
        }
        get {
            return self.frame.origin.y
        }
    }
    
    var w : CGFloat {
        set {
            self.frame = CGRect.init(origin: self.frame.origin, size: CGSize.init(width: newValue, height: self.frame.size.height))
        }
        get {
            return self.frame.size.width
        }
    }
    
    var h : CGFloat {
        set {
            self.frame = CGRect.init(origin: self.frame.origin, size: CGSize.init(width: self.frame.size.width, height: newValue))
        }
        get {
            return self.frame.size.height
        }
    }
    
    var bottom : CGFloat {
        get {
            return self.y + self.h
        }
    }
    
    var right : CGFloat {
        get {
            return self.x + self.w
        }
    }
    
    var cornerRadius : CGFloat {
        set {
            self.layer.cornerRadius = newValue
            self.layer.masksToBounds = true
        }
        get {
            return self.layer.cornerRadius;
        }
    }
    
}

